package com.ym.manager.admin.user;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author 但何非
 * @Date 2022/11/16 14:36
 * @ClassName: AccountFlowType
 * @Description:
 * @Version:
 */
public enum AccountFlowType {
    INCOME("1", "月结发钱"), APPLY_FOR_WITHDRAWAL("2", "余额提现申请"), WITHDRAWAL_SUCCESS("3", "余额提现成功"),
    WITHDRAWAL_UNDO("4", "余额提现撤销"), UNKNOWN("KNOW", "未知"), APPLY_FAIL_WITHDRAWAL("5", "余额申请提现未通过"),
    PLAT_WITHDRAWAL_SUCCESS("6", "余额提现成功平台同步扣款"), TYPE_RECHARGE("7", "余额充值"), TYPE_RED_SEND("8", "佣金转发"),
    TYPE_RED_RECV("9", "佣金接收"), TYPE_RED_EXPR("10", "佣金退回"), WITHDRAWAL_FAIL("11", "余额提现失败"),
    COUPON_BUY("12", "购买优惠券"), TYPE_TRANSFER_SEND("13", "佣金转发"),
    TYPE_TRANSFER_RECV("14", "佣金接收"), TYPE_TRANSFER_EXPR("15", "佣金退回"), POPULARIZE("16","余额收益提现"),
    PAY_ORDER_MONEY_REFUND("17","商品支付退款"), PAY_ORDER_MONEY_FREE("18","提现手续费")
    , PAY_ORDER("19","商品支付扣款"),PAY_ORDER_MONEY("20","商品支付收款");
    public String code;
    public String name;

    AccountFlowType(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static String getNameByCode(String key) {
        for (AccountFlowType object : AccountFlowType.values()) {
            if (object.getCode().equals(key)) {
                return object.getName();
            }
        }
        return "未知枚举";
    }

    public static List<Map<String,Object>> gettypeList() {
        List<Map<String,Object>> list = new ArrayList<>();
        Map<String,Object> map = null;
        for (AccountFlowType object : AccountFlowType.values()) {
            map = new HashMap<>();
            map.put("id",object.getCode());
            map.put("name",object.getName());
            list.add(map);
        }
        return list ;
    }
}
